package org.weatherapplication;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;

public class AddCityActivity extends Activity {
	private EditText etCityName;
	
	/** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
    	super.onCreate(savedInstanceState);
    	setContentView(R.layout.add_city);
    	
    	etCityName = (EditText) findViewById(R.id.etCityName);
    }
    
    /** Crearea unui Intent prin care se trimite numele orasului si terminarea activitatii. */
    public void btnAddClick(View v) {
    	String cityName = etCityName.getText().toString();
    	cityName = cityName.toLowerCase();
    	String str = String.valueOf(Character.toUpperCase(cityName.charAt(0))) + cityName.substring(1);
    	Intent answer = new Intent();
    	answer.putExtra("cityToBeAdded", str);
    	setResult(1, answer);
    	finish();
    }
    
    /** Terminarea activitatii fara nicio modificare asupra listei de orase. */
    public void btnCancelClick(View v) {
    	setResult(0);
    	finish();
    }
}
